<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        div {
            width: 200px;
            height: 400px;
            border: 2px solid #00dd00;
            text-align: center;
        }

        ul {
            width: 200px;
            height: 50px;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }
        ul li{
            width: 30px;
            height: 15px;
            background-color: pink;
        }
        ul li.active{
            background-color: #0f0;
        }
        ol{
            width: 200px;
            height: 350px;
            /* overflow: hidden; */
            line-height: 350px;
        }
        ol li{
            width: 200px;
            height: 350px;
            background-color:skyblue;
            display: none;
        }
        ol li.active{
         display: block;   
      
        }
        
    </style>
</head>

<body>
    <div>
        <ul>
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
        </ul>
        <ol>
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
        </ol>
    </div>
</body>
<script>
    // var ul=document.querySelector()
    var ulis=document.querySelectorAll('ul>li')
    var olis=document.querySelectorAll('ol>li')
    console.log(ulis);
    // ulis.onclick=()=>{
    //     for(let i=0;i<ulis.length;i++){
    //          console.log(i);
    //     }
    // }
   for(let i=0;i<ulis.length;i++){
       ulis[i].onclick=function(){
           console.log(i);
           for(var j=0;j<ulis.length;j++){
               ulis[j].className=''
               olis[j].className=''
           }
           ulis[i].className=olis[i].className='active'
       }
   }
</script>

</html>